package springcloud;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;

/**
 * 内容：
 *
 * @author
 * @date 2021/2/27-17:02
 */

@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker			//开始hystrix（CircuitBreaker）错误熔断机制功能
public class SpringCloud_Dept_8001Application {
	public static void main(String[] args) {

		SpringApplication.run(SpringCloud_Dept_8001Application.class,args);
	}

		@Bean                //增加一个servlet，配合监控页面使用，固定写死的
	public ServletRegistrationBean hystrixMetricsStreamServlet(){
		ServletRegistrationBean re = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
		re.addUrlMappings("/actuator/hystrix.stream");
		return re;
	}
}
